<template>
  <div>
    <!-- 头部搜索部分 -->
    <div class="top">
      <!-- 搜索行 -->
      <div class="topserch">
        <span class="serchleft"
          >北京
          <span
            class="iconfont icon-iconfontarrowup"
            style="font-size: 10px; color: #9999"
          ></span
        ></span>
        <div class="serch">
          <span style="font-size: 10px; color: #9999; margin-left: 10px"
            >请在这里输入区域/商圈</span
          >
          <span
            class="iconfont icon-sousuo"
            style="font-size: 10px; color: #9999"
          ></span>
        </div>
        <span class="serchright">地图找房</span>
      </div>
      <!-- 找房按钮 -->
      <div class="house">
        <div class="classhouse">
          <span
            class="iconfont icon-shangpu"
            style="font-size: 30px; color: #fd6f0f"
          ></span>
          <span>找商铺</span>
        </div>
        <div class="classhouse">
          <span
            class="iconfont icon-xiezilou"
            style="font-size: 30px; color: #faae07"
          ></span>
          <span>找写字楼</span>
        </div>
        <div class="classhouse">
          <span
            class="iconfont icon-xiaoqu"
            style="font-size: 30px; color: #f5ac8d"
          ></span>
          <span>找小区</span>
        </div>
      </div>
    </div>
    <!-- 筛选部分 -->
    <div class="screening">
      <div class="screeningleft">
        <span
          >区域<span
            class="iconfont icon-iconfontarrowup"
            style="font-size: 10px; color: #9999"
          ></span
        ></span>
        <span
          >价格<span
            class="iconfont icon-iconfontarrowup"
            style="font-size: 10px; color: #9999"
          ></span
        ></span>
        <span
          >户型<span
            class="iconfont icon-iconfontarrowup"
            style="font-size: 10px; color: #9999"
          ></span
        ></span>
        <span
          >筛选<span
            class="iconfont icon-iconfontarrowup"
            style="font-size: 10px; color: #9999"
          ></span
        ></span>
      </div>
      <div class="screeningright">
        <span class="iconfont icon-paixu" style="font-size: 18px"></span>
      </div>
    </div>
    <div class="list">
      <dl v-for="item in rentingList" :key="item.id" 
      @click="toDetail(item.id)"
      >
        <dt><img :src="item.img" alt="" /></dt>
        <dd>
          <h3>{{ item.estate_name }}</h3>
          <p class="detail">
            <span>{{ item.acreage }}</span
            >/ <span>{{ item.room }}室{{ item.living_room }}厅</span>/
            <span>{{ item.city }}</span>
          </p>

          <p>
            <span class="price">{{ item.price }}</span>
          </p>

          <p>
            <span class="xiao">小区</span>
          </p>
        </dd>
      </dl>
    </div>
  </div>
</template>
<script>
import { getRentingList } from "../../../server";
export default {
  components: {},
  data() {
    return {
      rentingList: [],
    };
  },
  async created() {
    let res = await getRentingList();
    if (res.code == 200) {
      this.rentingList = res.data;
    }
    console.log(this.rentingList);
  },
  methods:{
    toDetail(id){
       console.log(id);
        uni.navigateTo({
        url: `/pages/detail/RentingDetail?id=${id}`,
      });
    }
  }
};
</script>


<style lang="scss" scoped>
 @import "../../../g_icon/iconfont.css";
.topserch {
  margin-top: 5px;
  display: flex;
  justify-content: space-around;
  align-items: center;
  .serchleft,
  .serchright {
    width: 80px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .serch {
    height: 20px;
    width: calc(100% - 160px);
    border: 1px solid #9999;
    background-color: #f4f4f4;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
}
.house {
  display: flex;
  align-items: center;
  justify-content: space-around;
  margin-top: 15px;
  padding-bottom: 15px;
  border-bottom: 1px solid #000;
  .classhouse {
    display: flex;
    flex-direction: column;
    align-items: center;
  }
}
.screening {
  display: flex;
  height: 30px;
  align-items: center;
  border-bottom: 1px solid #000;
  .screeningright {
    width: 50px;
    text-align: center;
  }
  .screeningleft {
    width: calc(100% - 50px);
    display: flex;
    justify-content: space-around;
  }
}
.list {
  width: 96%;
  margin-left: 2%;
  dl {
    width: 100%;
    height: 300rpx;
    display: flex;
    border-bottom: 1px solid #eee;

    dt {
      width: 300rpx;
      height: 200rpx;
      padding-top: 60rpx;
      img {
        width: 300rpx;
        height: 200rpx;
      }
    }
    dd {
      padding-top: 60rpx;
      padding-left: 20rpx;
      h3 {
        font-weight: 700;
        font-size: 35rpx;
      }
      .detail {
        font-size: 28rpx;
        color: #333;
        margin-top: 10rpx;
        margin-bottom: 10rpx;
      }

      .price {
        font-weight: 600;
        color: #FF9900;
      }
      .xiao{
          display: inline-block;
          width: 80rpx;
          height: 40rpx;
          font-size: 25rpx;
          text-align: center;
          line-height: 40rpx;
          background-color:#eee;
          margin-top: 10rpx;
      }
    }
  }
}
</style>